import 'dart:io';

import 'package:bwt_ad_flutter/et/BwtAdLogType.dart';
import 'package:bwt_ad_flutter_example/page/SplashAdLauncherPage.dart';
import 'package:bwt_ad_flutter_example/util/DisplayUtil.dart';
import 'package:flutter/material.dart';
import 'package:bwt_ad_flutter/BwtAdCore.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  /// 初始化广告插件
  await BwtAdCore.init(
    appId: Platform.isAndroid ? '071475' : '465533',
    // iOS请求广告前是否先申请IDFA，默认true
    isRequestIdfa: true,
    // 广告内部日志打印设置，默认为NONE（不打印），正式包建议设置为NONE
    logType: BwtAdLogType.DEBUG,
  );

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    DisplayUtil.init(context);

    return const MaterialApp(
      home: Scaffold(
        body: SplashAdLauncherPage(),
      ),
    );
  }
}
